# -*- encoding=utf8 -*-
"""
RedFlag-TC0000121  （拍摄进入装饰页）清除所有装饰特效功能
清除所有装饰特效场景
"""
__author__ = "ldm"

import sys
import os

# 获取当前脚本所在目录.py
current_dir = os.path.dirname(os.path.abspath(__file__))
# 获取上级目录.air
parent_dir = os.path.dirname(current_dir)
# 获取上级目录air
grandparent_dir = os.path.dirname(parent_dir)
# 获取和air目录平级的conf、testcase目录路径
conf_dir = os.path.join(grandparent_dir, 'conf')
testcase_dir = os.path.join(grandparent_dir, 'testcase')
# 将conf、testcase目录添加到sys.path
sys.path.append(conf_dir)
sys.path.append(testcase_dir)

from PageFunction import CameraVideoShooter
from elements import *

auto_setup(__file__)
shooter = CameraVideoShooter()

log("--------------------------------清除所有装饰特效场景--------------------------------------")
"""
拍摄视频进入装饰页
点击文字
新增一个文字
点击确认
点击滤镜
新增一个滤镜
取消滤镜工具栏
点击贴纸
新增一个贴纸
点击特效
新增一个特效
点击确认
点击上一步
而且确认弹窗点击取消
点击新增的文字
点击删除
点击新增的贴纸
点击删除
点击滤镜
点击清除滤镜
取消滤镜工具栏
点击特效
选中特效
点击删除
点击确认
点击上一步
断言
"""

shooter.enter_photography_decoration_page()
shooter.click_element(decoration_page_text_function)
shooter.random_input_chars(decoration_page_text_function_input, 25)
shooter.click_element(decoration_page_text_function_confirm)
shooter.click_element(decoration_page_filter_function)
shooter.click_element(decoration_page_filter_original_aspiration)
touch((0.5,0.5))
shooter.click_element(decoration_page_sticker)
shooter.click_element(decoration_page_sticker_effect)
shooter.click_element(decoration_page_special_effects)
shooter.click_and_hold_element(decoration_page_special_effects_effect, 3)
shooter.click_element(decoration_page_special_effects_confirm)
shooter.click_element(decoration_page_return_button)
shooter.click_element(decoration_page_return_cancel)
touch((0.5,0.5))
shooter.click_element(decoration_page_sticker_delete)
touch((0.5,0.5))
shooter.click_element(decoration_page_text_editing_delete)
shooter.click_element(decoration_page_filter_function)
shooter.click_element(decoration_page_filter_clean)
touch((0.5,0.5))
shooter.click_element(poco("cn.migu.video.clip.walle:id/dokit_app_contentview_id").offspring("cn.migu.video.clip.walle:id/clip_et_tx_handle").child("android.widget.ImageView"))
touch((0.15,0.7))
shooter.click_element(decoration_page_special_effects_delete)
shooter.click_element(poco("cn.migu.video.clip.walle:id/comfirmIV"))
shooter.click_element(poco("cn.migu.video.clip.walle:id/clip_comm_title_left_btn"))
shooter.click_element(decoration_page_return_confirm)
shooter.assert_element_exists(shooting_page_next_button, "断言失败，预期元素并未出现")

# 关闭应用
stop_app(UGC_package_name)